<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
	<th:block th:insert="~{include :: header('控制台')}" />
</head>
<body class="hold-transition">
<!-- Site wrapper -->
<div class="container-fluid mt-2 mb-2">
	<!-- Small boxes (Stat box) -->
	<div class="row">
		<div class="col-lg-4 col-6">
			<!-- small box -->
			<div class="small-box bg-info">
				<div class="inner">
					<h3 th:text="${webCountMap.toDayDeal}+' 单'"></h3>
					<p>今日成单数</p>
				</div>
				<div class="icon">
					<i class="ion ion-bag"></i>
				</div>
				<a href="#" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a>
			</div>
		</div>
		<!-- ./col -->
		<div class="col-lg-4 col-6">
			<!-- small box -->
			<div class="small-box bg-success">
				<div class="inner">
					<h3 th:text="${webCountMap.sumToDayMoney/100}+' 元'"></h3>
					<p>今日成交额</p>
				</div>
				<div class="icon">
					<i class="ion ion-stats-bars"></i>
				</div>
				<a href="#" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a>
			</div>
		</div>
		<div class="col-lg-4 col-6">
			<!-- small box -->
			<div class="small-box bg-danger">
				<div class="inner">
					<h3 th:text="${webCountMap.payAmount/100}+' 元'">150</h3>
					<p>总销售额</p>
				</div>
				<div class="icon">
					<i class="ion ion-pie-graph"></i>
				</div>
				<a href="#" class="small-box-footer">More info <i class="fas fa-arrow-circle-right"></i></a>
			</div>
		</div>
		<!-- ./col -->
	</div>
	<!-- Info boxes -->
	<div class="row">
		<div class="col-6 col-sm-4 col-lg-2">
			<div class="info-box">
				<span class="info-box-icon">
					<i class="fas fa-rss"></i>
				</span>

				<div class="info-box-content">
					<span class="info-box-text">资讯</span>
					<span class="info-box-number text-red" th:text="${webCountMap.articleCount + ' 条'}">
                  10
                </span>
				</div>
				<!-- /.info-box-content -->
			</div>
			<!-- /.info-box -->
		</div>
		<!-- /.col -->
		<div class="col-6 col-sm-4 col-lg-2">
			<div class="info-box mb-3">
				<span class="info-box-icon"><i class="fas fa-audio-description"></i></span>

				<div class="info-box-content">
					<span class="info-box-text">课程</span>
					<span class="info-box-number text-red" th:text="${webCountMap.courseCount + ' 课'}">41,410</span>
				</div>
				<!-- /.info-box-content -->
			</div>
			<!-- /.info-box -->
		</div>
		<!-- /.col -->

		<!-- fix for small devices only -->
		<div class="clearfix hidden-md-up"></div>

		<div class="col-6 col-sm-4 col-lg-2">
			<div class="info-box mb-3">
				<span class="info-box-icon"><i class="fas fa-user"></i></span>

				<div class="info-box-content">
					<span class="info-box-text">用户</span>
					<span class="info-box-number text-red" th:text="${webCountMap.userCount + ' 位'}">760</span>
				</div>
				<!-- /.info-box-content -->
			</div>
			<!-- /.info-box -->
		</div>
		<div class="col-6 col-sm-4 col-lg-2">
			<div class="info-box mb-3">
				<span class="info-box-icon"><i class="fa fa-first-order"></i></span>
				<div class="info-box-content">
					<span class="info-box-text">总订单</span>
					<span class="info-box-number text-red" th:text="${webCountMap.orderCount} +' 单'">2,000</span>
				</div>
				<!-- /.info-box-content -->
			</div>
			<!-- /.info-box -->
		</div>
		<!-- /.col -->
		<div class="col-6 col-sm-4 col-lg-2">
			<div class="info-box mb-3">
				<span class="info-box-icon"><i class="fa fa-balance-scale"></i></span>
				<div class="info-box-content">
					<span class="info-box-text">成交订单</span>
					<span class="info-box-number text-red" th:text="${webCountMap.orderSuccessCount} +' 单'">2,000</span>
				</div>
				<!-- /.info-box-content -->
			</div>
			<!-- /.info-box -->
		</div>
		<!-- /.col -->
	</div>
	<!-- /.row -->
	<div class="row">
		<div class="col-sm-12">
			<div class="card card-default">
				<div class="card-header">
					<h3 class="card-title">
						<i class="fa fa-clipboard"></i>
						最新成交订单
					</h3>
					<div class="card-tools">
						<a class="btn btn-info btn-sm" href="javascript:void(0)" onclick="$.modal.openTab('订单列表', '/order/list.html');">
							<i class="fa fa-arrow-right"></i> 查看更多
						</a>
					</div>
				</div>
				<!-- /.card-header -->
				<div class="card-body">
					<table class="table table-hover">
						<thead>
						<tr>
							<th style="width: 220px;">订单号</th>
							<th style="width: 60px;">类型</th>
							<th style="width: 150px;">用户</th>
							<th style="width: 100px;">金额</th>
							<th>描述</th>
							<th style="width: 200px;">时间</th>
						</tr>
						</thead>
						<tbody id="orderToBody"></tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
</div>
<th:block th:insert="~{include :: footer}" />
<script>
	$(function () {
		//最近课程
		$.post("/order/list.json", {"status": "SUCCESS", "limit": 10}, function (json) {
			var str = "";
			json.rows.forEach(function (value, index) {
				var orderType;
				switch (value.orderType) {
					case "COURSE":
						orderType = "课程";
						break;
					case "MEMBER":
						orderType = "会员";
						break;
					case "ACCOUNT":
						orderType = "充值";
						break;
					default:
						orderType = "未知";
				}
				str += "<tr>" +
						"<td>" + value.orderNo + "</td>" +
						"<td>" + orderType + "</td>" +
						"<td>" + value.userName + "</td>" +
						"<td style='color: red;'>" + value.payAmount / 100 + "</td>" +
						"<td>" + value.description + "</td>" +
						"<td>" + (value.payTime != null ? value.payTime : '-') + "</td>" +
						"</tr>";
			})
			$("#orderToBody").empty().append(str);
		});
	});
</script>
</body>
</html>
